//
//  ZLWrongParsingHeaderView.m
//  ZLExamination
//
//  Created by Zheng on 2017/9/13.
//  Copyright © 2017年 Zheng. All rights reserved.
//

#import "ZLWrongParsingHeaderView.h"

@implementation ZLWrongParsingHeaderView

- (instancetype)init {
    self = [super init];
    if (self) {
        [self addSubview:self.numberLbl];
        [self addSubview:self.titleLbl];
//        [self addSubview:self.collectBtn];
        
        [_numberLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(12);
            make.centerY.equalTo(self);
        }];
        
        [_titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_numberLbl.mas_right).offset(15);
            make.width.mas_equalTo(67);
            make.height.mas_equalTo(17);
            make.centerY.equalTo(self);
        }];
        
        [_collectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-10);
            make.height.with.mas_equalTo(35);
            make.centerY.equalTo(self);
        }];
        
    }
    return self;
}

- (UILabel *)numberLbl {
    if (!_numberLbl) {
        _numberLbl = [[UILabel alloc] init];
        _numberLbl.font = kMyFont(14);
        _numberLbl.textColor = kMY_BLUE_COLOR;
    }
    return _numberLbl;
}

- (UILabel *)titleLbl {
    if (!_titleLbl) {
        _titleLbl = [[UILabel alloc] init];
        _titleLbl.font = kMyFont(11);
        _titleLbl.textColor = [UIColor whiteColor];
        _titleLbl.textAlignment = NSTextAlignmentCenter;
        _titleLbl.layer.cornerRadius = 6;
        _titleLbl.layer.backgroundColor = [kMY_BLUE_COLOR CGColor];
        _titleLbl.text = @"单项选择题";
    }
    return _titleLbl;
}

- (UIButton *)collectBtn {
    if (!_collectBtn) {
        _collectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_collectBtn setImage:kIMAGE(@"形状-1-拷贝") forState:UIControlStateNormal];
        [_collectBtn setImage:kIMAGE(@"形状-1") forState:UIControlStateSelected];
        [_collectBtn addTarget:self action:@selector(collectBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _collectBtn;
}

#pragma mark - 点击事件
- (void)collectBtnAction:(UIButton *)sender {
    if (_collectCallBack) {
        _collectCallBack(_pageNumber,sender);
    }
}


@end
